package com.ms.service.module.fish.message;

import java.io.Serializable;
import java.nio.ByteBuffer;

import org.jboss.netty.util.CharsetUtil;

import com.xpec.c4.game.utility.GUID;

public class FishRequestWrap implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private GUID sessionId;
	
	private ByteBuffer buf;
	
	public FishRequestWrap(ByteBuffer buf) {
		this.buf = buf;
	}
	
	public byte getByte(){
		return buf.get();
	}
	
	public int getInt(){
		return buf.getInt();
	}
	
	public long getLong(){
		return buf.getLong();
	}
	
	/**
	 * 获取UTF8的字符串
	 * @return
	 */
	public String getString(){
		int length = buf.getShort();
		byte[] dst = new byte[length];
		buf.get(dst);
		return new String(dst,CharsetUtil.UTF_8);
	}

	public GUID getSessionId() {
		return sessionId;
	}

	public void setSessionId(GUID sessionId) {
		this.sessionId = sessionId;
	}

	
}

